package environment
{
    /**
     * This contains all the necessary information for a single "Vert", being a combination of the data
     * for the toxic, nutrient, and fluidity meshes for a particular X,Y point.
     * 
     * @author jjung
     */
    public class EnvVert
    {
        public static const TOXIC : int = 0; // RED
        public static const NUTRIENT : int = 1; // GREEN
        public static const FLUID : int = 2; // BLUE
        
        //----------------------------------
        // TOXIC, NUTRIENT, and FLUID
        //----------------------------------
        public var vertIxs : Array = []; //3 Numbers in a row
        public var colorIxs : Array = []; //4 numbers in a row
        public var layers : Array = []; 
        
        public var x : int;
        public var y : int;
        
        public function EnvVert(x : int, y : int)
        {
            this.x = x;
            this.y = y;
        }
        
        public function getVertValue(layerIx : int, offset : int) : Number
        {
            return (layers[layerIx] as EnvironmentLayer).envPlane.getVertValue(vertIxs[layerIx] + offset);
        }
        
        public function getVertColor(layerIx : int, offsetRGB : int) : Number
        {
            return (layers[layerIx] as EnvironmentLayer).envPlane.getVertColor(colorIxs[layerIx]+ offsetRGB);
        }
        
        public function setVertValue(layerIx : int, offset : int, value : Number) : void
        {
            (layers[layerIx] as EnvironmentLayer).envPlane.setVertValue(vertIxs[layerIx] + offset, value);
        }
        
        public function setVertColor(layerIx : int, offsetRGB : int, value : Number) : void
        {
            (layers[layerIx] as EnvironmentLayer).envPlane.setVertColor(colorIxs[layerIx] + offsetRGB, value);
        }
        
        public function addVertColor(layerIx : int, valueChange : Number) : void
        {
            (layers[layerIx] as EnvironmentLayer).envPlane.addVertColor(colorIxs[layerIx] + layerIx, valueChange);
        }
        
        public function addVertValue(layerIx : int, valueChange : Number) : void
        {
            (layers[layerIx] as EnvironmentLayer).envPlane.addVertValue(vertIxs[layerIx] + 2, valueChange);
        }
    }
}